package com.dld.protocol;

import android.app.Activity;
import android.content.Context;

import com.dld.android.net.Param;
import com.dld.android.persistent.SharePersistent;
import com.dld.coupon.activity.ActivityManager;
import com.dld.coupon.activity.AroundActivity;
import com.dld.coupon.util.MapUtil;
import com.dld.coupon.util.PhoneUtil;
import com.dld.coupon.util.MapUtil.LatAndLon;
import com.dld.coupon.view.CardDialogue;
import com.dld.protocol.json.CProtocol;
import com.dld.protocol.json.Protocol;

public class CommonProtocolHelper {
//	public static Protocol allSearch(P) {
//		Activity localActivity = ActivityManager.getCurrent();
//		String area_code = SharePersistent.getInstance().getPerference(
//				localActivity, "city_id");
//		Param p = new Param();
//		p.append("r","www/api/search").append("userAgent","dld_android");
//		return new Protocol(p);
//		// return new CProtocol(localActivity, null, "all_search", new Param()
//		// .append("r", "www/api/list").append("userAgent",
//		// "dld_android").append("areaCode", area_code).append(
//		// "module", "" + moudle).append("pageSize",
//		// "" + pageSize).append("currentPage", "" + curPage)
//		// .append("categoryCode", "" + category));
//	}

	public static Protocol feedback(Context paramContext, String paramString1,
			String paramString2, String paramString3) {
		return new CProtocol(paramContext, null, "feedback", new Param()
				.append("content", paramString1).append("email", paramString2)
				.append("phone", paramString3), false);
	}

	public static Protocol getVersion(Context paramContext) {
		return new CProtocol(paramContext, null, "version", new Param().append(
				"imei", PhoneUtil.getIMEI(paramContext)), false);
	}

	public static Protocol like(Context paramContext, String paramString) {
		return new CProtocol(paramContext, null, "like", new Param().append(
				"id", paramString), false);
	}

	public static Protocol pay(Context paramContext, String paramString1,
			String paramString2, String paramString3, String paramString4) {
		return new CProtocol(paramContext, null, "pay", new Param().append(
				"website", paramString1).append("amount", paramString2).append(
				"card", paramString3).append("phone", paramString4), false);
	}

	public static Protocol searchAddress() {
		Activity localActivity = ActivityManager.getCurrent();
		MapUtil.LatAndLon localLatAndLon = AroundActivity.location;
		return new CProtocol(localActivity, null, "address", new Param()
				.append("lat", String.valueOf(localLatAndLon.lat)).append(
						"lng", String.valueOf(localLatAndLon.lon)));
	}

	public static Protocol sendEmail(Context paramContext, int paramInt,
			String paramString) {
		return new CProtocol(paramContext, null, "email", new Param().append(
				"id", String.valueOf(paramInt)).append("r",
				String.valueOf(paramString)), false);
	}

	public static Protocol shareToMicroblog(Context paramContext,
			String paramString1, String paramString2, String paramString3) {
		return new CProtocol(paramContext, null, "weibo", new Param().append(
				"name", paramString1).append("pwd", paramString2).append(
				"content", paramString3), false);
	}

	public static Protocol tip(String paramString) {
		return new CProtocol(ActivityManager.getCurrent(), null, "tip",
				new Param().append("prefix", paramString));
	}

	public static Protocol upload(Context paramContext, String paramString1,
			String paramString2, byte[] paramArrayOfByte) {
		CProtocol localCProtocol = new CProtocol(paramContext, null, "upload",
				new Param().append("shop", paramString1).append("description",
						paramString2), false);
		localCProtocol.data = paramArrayOfByte;
		return localCProtocol;
	}
}
